﻿@{
    Layout = "";
    ViewBag.MenuId = 1;
}
<style>
    .qg_empty_a {
    }

        .qg_empty_a .imgBox {
            float: inherit !important;
            width: 120px !important;
            height: 105px !important;
            margin: 10px auto 0 !important;
        }
</style>
<div ng-controller="ShopIndexCtrl">
    <div class="f_mb60">
        <!-- 优惠券类别切换 -->
        <div class="flayout_c_tabBox">
            <ul>
                <li class="active">
                    <div class="fliconBox">
                        <img src="/Content/images/f_76.png" alt="首页">
                    </div>
                    <span>首页</span>
                </li>
                <li ng-repeat="item in FirstCategoryList" ui-sref="shop.productlist({keywords:'',fcId:item.Id,scId:0})">
                    <div class="fliconBox" style="width:90%;height:90%;">
                        <img ng-src="{{ImgHostUrl+item.PicUrl}}" alt="{{item.CategoryName}}">
                    </div>
                    <span>{{item.CategoryName}}</span>
                </li>
            </ul>
        </div>
        <div class="clear"></div>
        <!--end 优惠券类别切换 -->
        <!-- 优惠券轮播图 -->

        <div>
            <div id="focus" class="focus">
                <div class="hd">
                    <ul></ul>
                </div>
                <div class="bd">
                    <ul>
                        <li ng-repeat="slide in slides"><a href="{{slide.url}}"><img  ng-src="{{slide.image}}" /></a></li>
                    </ul>
                </div>
            </div>
        </div>
        <!--end 优惠券轮播图 -->
        <!-- icon列表 -->
        <div class="flayout_m_iconBox">
            <ul>
                <li ui-sref="activity.spikelist">
                    <div ui-sref="activity.spikelist">
                        <div class="m_iconBox">
                            <img src="/Content/images/f_77.png" alt="限时秒杀">
                        </div>
                        <p>限时秒杀</p>
                    </div>
                </li>
                <li ui-sref="activity.dropgroupindex">
                    <div class="m_iconBox">
                        <img src="/Content/images/f_78.png" alt="降价拼团">
                    </div>
                    <p>降价拼团</p>
                </li>
                <li ui-sref="activity.index">
                    <div class="m_iconBox">
                        <img src="/Content/images/f_79.png" alt="一分钱活动">
                    </div>
                    <p>一分钱活动</p>
                </li>
                <li ui-sref="draw.index">
                    <div class="m_iconBox" style="display:block;">
                        <img src="/Content/images/f_80.png" alt="积分抽奖">
                    </div>
                    <p>积分抽奖</p>
                </li>
            </ul>
            <div class="clear"></div>
        </div>
        <!--end icon列表 -->
        <!-- 头条新闻 -->
        <div class="m_headlinesBox">
            <div class="left">
                <img src="/Content/images/f_81.png" alt="头条">
            </div>
            <div class="txtMarquee-top">
                <div class="hd">
                    <a class="next"></a>
                    <a class="prev"></a>
                </div>
                <div class="bd">
                    <ul class="infoList">
                        <li ng-repeat="item in HeadlineList"><a href="{{item.LinkUrl}}" style="white-space:nowrap; text-overflow:ellipsis; overflow:hidden;">{{item.Tittle}}</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <!--end 头条新闻 -->
        <!-- 特惠购 -->
        <div class="m_fl1">
            <h3 class="m_fltxt"><img src="/Content/images/f_83.png"></h3>
            <div class="m_fl1_mainBox">
                <div class="m_fl1_topBox">
                    <div class="leftBox" >
                        <div ng-show="Spike.Id>0" ui-sref="activity.spikelist">
                            <p class="m_fl1_hd" style="font-weight:bold;color:black">{{Spike.Name}}</p>
                            <p class="m_fl1_hd_g">{{Spike.SubTitle}}</p>
                            <div class="imgBox">
                                <img ng-src="{{ImgHostUrl+Spike.HeadPicUrl}}" alt="限时秒杀">
                            </div>
                        </div>
                        <div class="qg_empty_a" ng-show="Spike.Id==0">
                            <div class="imgBox">
                                <img src="/Content/images/idx_qg_empty.png" alt="限时秒杀">
                            </div>
                        </div>
                    </div>
                    <div class="rightBox">
                        <div class="topB" ng-show="DropGroup!=null&&DropGroup.DropGroupID>0">
                            <a href="javascript:void(0)" ng-click="opengroup(DropGroup.DropGroupID)">
                                <p class="m_fl1_hd" style="font-weight:bold;color:black">拼好货</p>
                                <p class="m_fl1_hd_g">{{DropGroup.Title}}</p>
                                <p class="m_fl1_price priceP">降拼价¥{{DropGroup.FloorPrice}}</p>
                                <div>
                                    <img src="{{ImgHostUrl+DropGroup.CoverImg}}" alt="拼好货">
                                </div>
                            </a>
                        </div>
                        <div class="topB" ng-show="isdropshow==0">
                            <p class="m_fl1_hd_g" style="padding-top:25px;font-weight:bold;color:black">暂无活动</p>
                            <img src="/Content/images/f_111.png" alt="拼好货">
                        </div>
                        <div class="bottomB" ng-show="Activity!=null&&Activity.Id>0">
                            <a href="javascript:void(0)" ng-click="$state.go('activity.activityinfo',{Id:Activity.Id})">
                                <p class="m_fl1_hd" style="margin-top: 5px;font-weight:bold; color:black">一分钱活动</p>
                                <p class="m_fl1_hd_g">{{Activity.ActivityName}}</p>
                                <img src="{{ImgHostUrl+Activity.CoverImg}}" alt="一分钱活动">
                            </a>
                        </div>
                        <div class="bottomB" ng-show="isactivityshow==0">
                            <p class="m_fl1_hd_g" style="padding-top:25px;font-weight:bold;color:black">暂无活动</p>
                            <img src="/Content/images/f_111.png" alt="一分钱活动">
                        </div>
                    </div>
                </div>
                <div class="m_fl1_bottomBox">
                    <div class="left">
                        <div ui-sref="user.sign">
                            <div class="leftside">
                                <p class="btb_hd">积分商城</p>
                                <p class="btb_hd_g">积分兑换礼品</p>
                            </div>
                            <img src="/Content/images/f_87.png" alt="">
                        </div>
                    </div>
                    <div class="right">
                        <div ui-sref="draw.index">
                            <div class="leftside">
                                <p class="btb_hd">积分抽奖</p>
                                <p class="btb_hd_g">积分抽奖礼品</p>
                            </div>
                            <img src="/Content/images/f_88.png" alt="">
                        </div>                        
                    </div>
                </div>
                <div class="clear"></div>
            </div>
        </div>
        <!--end 特惠购 -->
        <!-- 广告 -->
        <div class="m_bannerBox" ng-show="AdList.length>0" >
            <a href="javascript:void(0)" ng-click="go(AdList[0].LinkUrl)"><img ng-src="{{ImgHostUrl+AdList[0].ImgUrl}}"></a>
        </div>
        <!-- 广告 -->
        <!-- 主题馆 -->
        <div class="m_fl2" ng-show="TopicList.length>0">
            <h3 class="m_fltxt"><img src="/Content/images/f_90.png"></h3>
            <div class="m_fl2_main1">
                <div ng-repeat="topic in TopicList" class="m_fl2_each m_fl2_eachbg{{$index+1}}" ui-sref="activity.specialtopic({Id:topic.Id})">
                    <div class="left_txtBox">
                        <p class="m_fl2_each_hd">{{topic.Name}}</p>
                        <p class="m_fl2_each_color color{{$index+1}}">{{topic.TopicDescription}}</p>
                    </div>
                    <div class="right_imgBox">
                        <img ng-src="{{ImgHostUrl+topic.ImgUrl}}" alt="">
                    </div>
                </div>
                <div class="clear"></div>
            </div>


        </div>
        <!--end 主题馆 -->
        <!-- 广告 -->
        <div class="m_bannerBox" ng-show="AdList.length>1">
            <a href="javascript:void(0)" ng-click="go(AdList[1].LinkUrl)"><img ng-src="{{ImgHostUrl+AdList[1].ImgUrl}}"></a>
        </div>




        <!-- 广告 -->
        <div class="m_fl3" ng-show="RecommendProduct.length>0">
            <h3 class="m_fltxt"><img src="/Content/images/f_104.png"></h3>
            <!-- 产品列表 -->
            <section class="list_m_mdv srp">
                <div class="tile_box prolist1">
                    <a href="javascript:void(0)" class="tile_item" style="text-decoration:none;" ng-repeat="item in RecommendProduct" ui-sref="shop.productdetail({sku:item.Sku,activityId:0})">
                        <div class="ti_img_wrap ">
                            <img ng-src="{{ImgHostUrl+item.ImgUrl}}" class="ti_img">
                        </div>
                        <div class="ti_info">
                            <p class="tii_title">{{item.Name}}</p>
                            <div class="tii_price"><i class="list_m_font">¥</i>{{item.Price}}<span class="tii_sold"><i>¥{{item.MarketPrice}}</i></span></div>
                        </div>
                    </a>

                </div>
            </section>
            <div class="clear"></div>
            <!-- end产品列表 -->
        </div>
    </div>
   
    @Html.Partial("_homefoot")
</div>

<script type="text/javascript">
    App.controller('ShopIndexCtrl', [
            '$scope', '$http', '$rootScope', '$stateParams', '$state', '$filter', '$timeout',
        function ($scope, $http, $rootScope, $stateParams, $state, $filter, $timeout) {
            $scope.DropGroup = {};
            $scope.isdropshow = 1;
            $scope.isactivityshow = 1;
            //数据初始化
            $http.post("/Home/ShopIndex", {}).then(function (response) {
                $scope.FirstCategoryList = response.data.FristCategoryList;
                $scope.CarouselList = response.data.CarouselList;
                $scope.HeadlineList = response.data.HeadlineList;
                $scope.AdList = response.data.AdList;
                $scope.RecommendProduct = response.data.RecommendProduct;
                $scope.Spike = response.data.Spike;
                $scope.TopicList = response.data.TopicList;

                // 设置轮播图图片间隔
                $scope.myInterval = 5000;
                // 轮播图数据初始化
                var slides = $scope.slides = [];
                // 添加轮播图源
                if ($scope.CarouselList.length > 0) {
                    angular.forEach($scope.CarouselList, function (img) {
                        slides.push({ image: $rootScope.ImgHostUrl + img.ImgUrl, url: img.LinkUrl });
                    });
                }

                var liNum = $scope.FirstCategoryList.length + 1;
                var parameter = 70;
                $(".flayout_c_tabBox ul").css("width", liNum * parameter);

                $timeout(function () {
                    jQuery(".txtMarquee-top").slide({ mainCell: ".bd ul", autoPlay: true, effect: "topMarquee", vis: 2, interTime: 100 });
                });

            });

            $http.post("/DropGroup/GetGropGroupTop1", {}).then(function (response) {
                if (response.data.Result && response.data.Result != "") {
                    $scope.DropGroup = response.data.Result;
                } else {
                    $scope.isdropshow = 0;
                }
            });

            $http.post("/Activity/GetActivityTop1", {}).then(function (response) {
                if (response.data.Result && response.data.Result != "") {
                    $scope.Activity = response.data.Result;
                } else {
                    $scope.isactivityshow = 0;
                }
            });

            $scope.opengroup = function (id) {
                $state.go('activity.dropgroupinfo', { "Id": id });
            }
            $scope.go = function (url) {
                location.href = url;
            }
            var tt = function () {
                $rootScope.WxShare($rootScope.pageTitle(), '优品三悦', location.href, $rootScope.LogoUrl);

                TouchSlide({
                    slideCell: "#focus",
                    titCell: ".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
                    mainCell: ".bd ul",
                    effect: "left",
                    autoPlay: true,//自动播放
                    autoPage: true, //自动分页
                    //switchLoad: "_src", //切换加载，真实图片路径为"_src"
                });
            }

            setTimeout(tt, 1000)
        }]);
</script>

<script>
    $(".flayout_c_tabBox ul li").each(function (e) {

        $(this).click(function () {

            $(".flayout_c_tabBox ul li").removeClass('active');
            $(this).addClass('active');
            // $(".flayout_c_tabBox .j_each_type").hide();

            // $(".flayout_c_tabBox .j_each_type:eq("+e+")").show();


        });

    });


</script>
